package com.healthMedical.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.healthMedical.mapper.MemberMapper;
import com.healthMedical.pojo.Member;
import com.healthMedical.service.MemberService;
import com.healthMedical.utils.MD5Utils;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service(interfaceClass = MemberService.class)
@Transactional
public class MemberServiceImpl implements MemberService {
    @Resource
    private MemberMapper memberMapper;

    @Override
    public Member findByTelephone(String telephone) {
        return memberMapper.findByTelephone(telephone);
    }

    @Override
    public void add(Member member) {
        if(member.getPassword() != null){
            member.setPassword(MD5Utils.md5(member.getPassword()));
        }
        memberMapper.add(member);
    }
}
